

f = open(file='file_test.txt',mode='r',encoding="utf-8")
data = f.read()
print(data)
f.close()



"""
# 字符编码智能识别
需要安装第三方库
pip3 install chardet
chardet.detect(data)
"""
import  chardet

f = open('log',mode = 'rb')
data = f.read()
f.close()

result = chardet.detect(open('log',mode='rb').read())
print(result)